home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cspotrun.arc / TEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-06-20  |  8.3 KB  |  313 lines

  1. #include <stdio.h>
  2. #include <color.h>
  3.  
  4. static char *array[] =
  5.  {
  6.   " General Information ",
  7.   "    Windows Demo     ",
  8.   "  Programming Tools  ",
  9.   "   Other Routines    ",
  10.   "     Exit to DOS     "
  11.  };
  12.  
  13. static char *more[] =
  14.  {
  15.   "    CheckC    ",
  16.   "     FLine    ",
  17.   " Header Files "
  18.  };
  19.  
  20. main()
  21.  {
  22.   int w;
  23.   int x;
  24.   int i;
  25.   char *temp;
  26.   save_cursor();
  27.   save_screen();
  28.   cls();
  29.   wcolor(LGRY_F+BLU_B,BLU_B);
  30.   w = wopen(0,0,9,20,2);
  31.   wcenter(w,1,"Introducing...");
  32.   for ( i = 0; i < 58; ++i )
  33.    {
  34.     wmove(w,2);
  35.     holdon();
  36.    }
  37.   for ( i = 0; i < 10; ++i )
  38.       wmove(w,3);
  39.   for ( i = 0; i < 55; ++i )
  40.       wmove(w,4);
  41.   for ( i = 0; i < 8; ++i )
  42.       wmove(w,1);
  43.   for ( i = 0; i < 26; ++i )
  44.    {
  45.     wmove(w,2);
  46.     holdon();
  47.    }
  48.   for ( i = 0; i < 3; ++i )
  49.       wmove(w,3);
  50.   wcenter(w,3,"C Spot Run");
  51.   wcenter(w,5,"A User-Supported");
  52.   wcenter(w,6,"C Add-on Library");
  53.   wmessage(w,"[ Any Key ]",0);
  54.   getch();
  55.   wclose(w);
  56.   while ( 1 )
  57.    {
  58.     mcolor(BLK_F+RED_B,WHT_F+BLU_B);
  59.     color(RED_F,WHT_B);
  60.     x = pop_menu(9,27,5,array," C Spot Run ",3);
  61.     if ( x == -1 )
  62.        break;
  63.     else if ( x == 4 )
  64.        break;
  65.     else if ( x == 3 )
  66.        other();
  67.     else if ( x == 2 )
  68.        utilities();
  69.     else if ( x == 1 )
  70.        wndwdemo();
  71.     else if ( x == 0 )
  72.        info();
  73.    }
  74.   wcloseall();
  75.   restore_screen();
  76.   restore_cursor();
  77.   exit(0);
  78.  }
  79.  
  80. other()
  81.  {
  82.   int w;
  83.   color(BLK_F,GRN_B);
  84.   w = wopen(10,10,20,60,1);
  85.   wtitle(w,"< Other Routines >",0);
  86.   wk(w);
  87.   wcenter(w,4,"This demo does not support other C Spot Run");
  88.   wcenter(w,5,"routines at this time.");
  89.   getch();
  90.   wclose(w);
  91.  }
  92.  
  93. info()
  94.  {
  95.   int w;
  96.   color(BOLD + BLU_F,BLK_B);
  97.   w = wopen(4,9,20,71,3);
  98.   wcenter(w,1,"C Spot Run");
  99.   wcenter(w,3,"Version 1.0  Copyright 1986 Bob Pritchett");
  100.   whline(w,5);
  101.   wcenter(w,7,"C Spot Run is a collection of routines and programming");
  102.   wcenter(w,8,"utilities for C programmers.  The purpose of this");
  103.   wcenter(w,9,"library is to provide low cost tools for programmers");
  104.   wcenter(w,10,"under the user-supported distribution concept.");
  105.   wcenter(w,11,"For more information, contact the author at the following");
  106.   wcenter(w,12,"address, or consult the C Spot Run manual accompanying");
  107.   wcenter(w,13,"this demonstration program.");
  108.   wk(w);
  109.   getch();
  110.   wclose(w);
  111.   w = wopen(7,28,17,52,3);
  112.   wtitle(w,"< Address >",0);
  113.   wcenter(w,1,"C Spot Run");
  114.   wcenter(w,3,"Bob Pritchett");
  115.   wcenter(w,4,"23 Pawtucket Dr.");
  116.   wcenter(w,5,"Cherry Hill, NJ 08003");
  117.   wcenter(w,7,"FidoNet 107/414");
  118.   wk(w);
  119.   getch();
  120.   wclose(w);
  121.  }
  122.  
  123. wk(num)
  124.  int num;
  125.  {
  126.   wmessage(num,"[ Press a Key ]",0);
  127.  }
  128.  
  129. wndwdemo()
  130.  {
  131.   int w;
  132.   int w2;
  133.   int w3;
  134.   wcolor(WHT_F+BLK_B,BOLD+GRN_F);
  135.   w = wopen(1,5,22,75,177);
  136.   wtitle(w," Do you do windows?... ",1);
  137.   wk(w);
  138.   wcenter(w,1,"With the C Spot Run window functions library, you have");
  139.   wcenter(w,2,"access to one of the most powerful windowing packages");
  140.   wcenter(w,3,"available, and by far one of the best priced.");
  141.   wcenter(w,4,"-- It's Free!! --");
  142.   wcenter(w,5,"That's right.  The object code, libraries, and utilities");
  143.   wcenter(w,6,"included in this package are absolutely free, and you may");
  144.   wcenter(w,7,"use them for any non-commercial purpose as long as credit");
  145.   wcenter(w,8,"is given.  For use in commercial applications, or to");
  146.   wcenter(w,9,"obtain the surce code, check in the included manual");
  147.   wcenter(w,10,"and contact the author.");
  148.   wcenter(w,12,"Speaking of credit, I'd like to thank Phillip A. Mongelluzzo");
  149.   wcenter(w,13,"whose source code taught me many of the techniques in this");
  150.   wcenter(w,14,"library, and who answered many questions for me.");
  151.   wcenter(w,16,"What follows is a small demonstration of some of the routines");
  152.   wcenter(w,17,"in the library, and a short explanation of each.  For a");
  153.   wcenter(w,18,"complete description, please consult your manual.");
  154.   getch();
  155.   wclose(w);
  156.   wcolor(BOLD + CYN_F+WHT_B,MAG_F);
  157.   w = wopen(5,7,22,70,4);
  158.   wprint(w,"Title anywhere with wtitle()...");
  159.   getch();
  160.   wtitle(w,"[ Left ]",1);
  161.   wtitle(w,"< Right ]",2);
  162.   wtitle(w,"< Center a Message >",0);
  163.   getch();
  164.   wprint(w,"Send a message with wmessage()...\n");
  165.   getch();
  166.   wmessage(w," Here... ",1);
  167.   wmessage(w," ...or here. ",2);
  168.   wk(w);
  169.   getch();
  170.   wprint(w,"We can skip around...");
  171.   wgotoxy(w,6,6);
  172.   wprint(w,"+ To here at 6,6 with wgotoxy()...");
  173.   getch();
  174.   wputat(w,7,4,"+ Or to 7,4 with wpuat()...");
  175.   getch();
  176.   wcenter(w,8,"Or center a line with wcenter().");
  177.   wgotoxy(w,10,0);
  178.   wprint(w,"Of course all output is done through an assembly routine,\n");
  179.   wprint(w,"just as cursor movement is...  We do stick with C for this:\n");
  180.   wprint(w,"(Go on, hit a key...)\n");
  181.   getch();
  182.   wjump(w,1,1);
  183.   getch();
  184.   wprint(w,"(Hit a key...)");
  185.   getch();
  186.   wprint(w,"\f The windws are all in a linked format, and can be moved\n");
  187.   wprint(w,"from fore to background easily.  Any call that involves a non\n");
  188.   wprint(w,"active window will activate that window before performing\n");
  189.   wprint(w,"it's action.  You may also close the windows in any order\n");
  190.   wprint(w,"you wish.\n");
  191.   wprint(w," The wactivate(window) function will activate the window\n");
  192.   wprint(w,"specified by window, and place it on 'top' of any overlapping\n");
  193.   wprint(w,"windows.\n");
  194.   getch();
  195.   color(BLU_F,RED_B);
  196.   w2 = wopen(5,5,20,35,2);
  197.   getch();
  198.   w3 = wopen(5,40,20,75,1);
  199.   getch();
  200.   whline(w2,2);
  201.   whline(w2,8);
  202.   wvline(w3,4);
  203.   wvline(w3,10);
  204.   wvline(w3,16);
  205.   wk(w2);
  206.   wk(w3);
  207.   getch();
  208.   wactivate(w);
  209.   getch();
  210.   wactivate(w2);
  211.   getch();
  212.   wactivate(w);
  213.   wactivate(w3);
  214.   getch();
  215.   wcloseall();
  216.   wcolor(WHT_F+BLU_B,BLU_F+WHT_B);
  217.   w = wopen(5,10,20,70,4);
  218.   wprint(w,"\tOf course there is a wprintf() function...\n");
  219.   for ( w2 = 0; w2 < 50; ++w2 )
  220.       wprintf(w,"Counting up...%03d.\n",w2);
  221.   wprintf(w,"Counting up...%03d.",w2);
  222.   getch();
  223.   wk();
  224.   wprint(w,"We can even set the scrolling boundaries...\n");
  225.   getch();
  226.   wcls(w);
  227.   wcenter(w,0,"Freeze this line.");
  228.   wcenter(w,wrow(w),"Freeze this also.");
  229.   wfreeze(w,1,wrow(w)-1);
  230.   whome(w);
  231.   for ( w2 = 0; w2 < 50; ++w2 )
  232.       wprintf(w,"Counting up...%03d.\n",w2);
  233.   wprintf(w,"Counting up...%03d.",w2);
  234.   getch();
  235.   wclose(w);
  236.  }
  237.  
  238. utilities()
  239.  {
  240.   int x;
  241.   while ( 1 )
  242.    {
  243.     color(MAG_F,BLK_B);
  244.     mcolor(CYN_F,RED_F+WHT_B);
  245.     x = pop_menu(10,10,3,more," Tools ",1);
  246.     if ( x == -1 )
  247.        return(-1);
  248.     else if ( x == 0 )
  249.        checkc();
  250.     else if ( x == 1 )
  251.        fline();
  252.     else if ( x == 2 )
  253.        headers();
  254.    }
  255.  }
  256.  
  257. checkc()
  258.  {
  259.   int w;
  260.   color(BOLD + MAG_F,BLK_B);
  261.   w = wopen(7,4,19,66,2);
  262.   wcenter(w,1,"CheckC");
  263.   whline(w,3);
  264.   wcenter(w,5,"CheckC is a small C code checker that checks for unmatched");
  265.   wcenter(w,6,"( ) { } [ ] \" \' in C source code.  Working with multiple");
  266.   wcenter(w,7,"files at once and correctly counting special cases, such");
  267.   wcenter(w,8,"as escape characters, makes this utility a valuable");
  268.   wcenter(w,9,"addition to your C debugging tools.");
  269.   wk(w);
  270.   getch();
  271.   wclose(w);
  272.  }
  273.  
  274. fline()
  275.  {
  276.   int w;
  277.   color(BOLD + GRN_F,BLK_B);
  278.   w = wopen(7,6,19,74,2);
  279.   wcenter(w,1,"FLine");
  280.   whline(w,3);
  281.   wcenter(w,5,"FLine is a small utility that scans source code and places");
  282.   wcenter(w,6,"and lines begining with a non-whitespace character into the");
  283.   wcenter(w,7,"output file specified on the command line.  This provides");
  284.   wcenter(w,8,"a useful reference file containing all function declerations,");
  285.   wcenter(w,9,"preproccessor statements, global variables, and comments.");
  286.   wk(w);
  287.   getch();
  288.   wclose(w);
  289.  }
  290.  
  291. holdon()
  292.  {
  293.   int i;
  294.   for ( i = 0; i < 250; ++i )
  295.       ;
  296.  }
  297.  
  298. headers()
  299.  {
  300.   int w;
  301.   color(BOLD + RED_F,BLK_B);
  302.   w = wopen(5,7,16,76,2);
  303.   wcenter(w,1,"Header Files");
  304.   whline(w,3);
  305.   wcenter(w,5,"The C Spot Run library contains a number of header files");
  306.   wcenter(w,6,"designed to make programming easier.  Color, special keys,");
  307.   wcenter(w,7,"sound, and character codes are all covered in the different");
  308.   wcenter(w,8,"header files included here.");
  309.   wk(w);
  310.   getch();
  311.   wclose(w);
  312.  }
  313.